package com.learning.java.optimize.design.pattern.strategy.impl;

import com.learning.java.optimize.design.pattern.strategy.DiscountStrategy;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
 * ClassName: VipDiscountStrategy
 * Description:
 * Date: 2020/3/22 17:22 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@Component
public class VipDiscountStrategy implements DiscountStrategy {

    private static final String VIP = "VIP";
    private static final double VIP_DISCOUNT = 0.95;


    @Override
    public boolean supportType(String type) {
        return Objects.equals(VIP, type);
    }

    @Override
    public double discount(double fee) {
        return fee * VIP_DISCOUNT;
    }

    @Override
    public String type() {
        return VIP;
    }
}
